package com.leTest.cmsService.controller;

import com.leTest.R;
import com.leTest.cmsService.entity.CrmBannerEntity;
import com.leTest.cmsService.service.CrmBannerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/cmsService/bannerFront")
@CrossOrigin
public class bannerFrontController {
    @Autowired
    private CrmBannerService bannerService;

    //根据banner的id进行降序排列,显示排列之后的前两条记录
    @Cacheable(value = "banner", key = "'selectIndexList'")
    @GetMapping("getAllBanner")
    public R getAllBanner() {
        List<CrmBannerEntity> list = bannerService.selectAllBanner();
        return R.ok().data("list", list);
    }

}
